package com.controller.seller;

import com.po.Buyerinfo;
import com.po.Sellerinfo;
import com.service.seller.SellerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
//卖家登录控制器
@Controller
@RequestMapping("/seller")
public class SellerLoginController {
    @Autowired
    private SellerService sellerService;

    @RequestMapping("/register")
    public String register(@ModelAttribute Sellerinfo suser, Model model, HttpSession session, String code) {
        return sellerService.register(suser, model, session, code);
    }
    @RequestMapping("/seller/login")
    public String login(@ModelAttribute Sellerinfo seller, Model model, HttpSession session) {
        return sellerService.login(seller, model, session);
    }
    @RequestMapping("/exit")
    public String exit(@ModelAttribute Sellerinfo seller,HttpSession session) {
        session.invalidate();
        return "seller/login";
    }
}
